#pragma once

#include "Alice/Resource/Shader.h"
#include "Alice/Resource/Texture2D.h"
#include "glm/glm.hpp"

namespace Alice
{

/*
    裁切纹理渲染器
    调用 OpenGL 的接口裁切一个图像并渲染
*/
class ClipTextureRenderer
{
public:
    /*
        初始化渲染数据
    */
    void Init();

    inline void SetShader(const Shader& shader) { m_shader = shader; }

    /*
        裁切并渲染一个纹理
    */
    void Render(
        Texture2D* texture,
        glm::vec2& position,
        glm::vec2& size,
        float rotate,
        glm::vec3& color,
        int width,
        int height,
        int frame_num
    );

    /*
        销毁渲染资源
    */
    void Destroy();

private:
    Shader m_shader;
    unsigned int m_VAO;
    unsigned int m_VBO;
};

} // namespace Alice
